<cfcomponent output="false">

	<cffunction name="MakeDonation" output="false" access="remote">
		<cfargument name="obj" required="true" />
 		<cfreturn createObject("component", "DonationDAO").create(arguments.obj) />
	</cffunction>

	<cffunction name="GetDonationDetailsByFoodDriveID" output="false" access="remote">
		<cfargument name="id" required="true" />
		<cfset var fd = GetByID(arguments.id) />
		<cfset var donations = "" />
		<cfset var qRead = "" />
		
		<cfquery username="#request.username#" password="#request.password#" name="qRead" datasource="nwharvest">
			SELECT ID
			FROM dbo.DONATIONS
			WHERE FooDriveID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.id#">
		</cfquery>

		<cfloop query="qRead">
		<cfscript>
			obj = createObject("component", "DonationDAO").read(qRead.ID);
			ArrayAppend(donations, obj);
		</cfscript>
		</cfloop>
		<cfreturn donations>		
		
	</cffunction>

	<cffunction name="GetDonationDetailsByUserID" output="false" access="remote">
		<cfargument name="id" required="true" />
		<cfset var fd = GetByID(arguments.id) />
		<cfset var donations = "" />
		<cfset var qRead = "" />
		
		<cfquery username="#request.username#" password="#request.password#" name="qRead" datasource="nwharvest">
			SELECT ID
			FROM dbo.DONATIONS
			WHERE UserID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.id#">
		</cfquery>

		<cfloop query="qRead">
		<cfscript>
			obj = createObject("component", "DonationDAO").read(qRead.ID);
			ArrayAppend(donations, obj);
		</cfscript>
		</cfloop>
		<cfreturn donations>		
		
	</cffunction>

</cfcomponent>